<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:insert="~{include :: header('订单详情')}" />
</head>
<body class="hold-transition">
<div class="container-fluid mt-2 mb-2">
    <form class="form-horizontal">
        <h4 class="form-header h4 pb-2" style="border-bottom: 1px solid #e0e0e0">订单信息</h4>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">订单ID</label>
            <span class="col-sm-3 col-form-label" th:text="${order.orderId}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">订单编号</label>
            <span class="col-sm-3 col-form-label" th:text="${order.orderNo}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">支付商户订单号</label>
            <span class="col-sm-3 col-form-label" th:text="${order.outTradeNo == null?'-':order.outTradeNo}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">用户</label>
            <div class="col-sm-3 col-form-label">
                [id：<span class="text-red" th:text="${user.userId}"></span>]
                <span th:text="${user.userName}"></span>
                (<span class="text-blue" th:text="${user.mobile}"></span>)
            </div>
        </div>


        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">订单原价</label>
            <div class="col-sm-3 col-form-label">
                <span class="text-red" th:text="${order.orderAmount / 100}"></span> 元
            </div>
            <label class="col-sm-2 text-sm-right col-form-label">优惠金额</label>
            <div class="col-sm-3 col-form-label">
                <span class="text-red" th:text="${order.couponAmount / 100}"></span> 元
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">优惠券编码</label>
            <span class="col-sm-3 col-form-label" th:text="${couponCodeDTO.couponCode == null?'-':couponCodeDTO.couponCode}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">支付类型</label>
            <span class="col-sm-3 col-form-label" th:text="${@dict.getLabel('qdx_order_payType', order.payType)}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">实付金额</label>
            <div class="col-sm-3 col-form-label">
                <span class="text-red" th:text="${order.payAmount / 100}"></span> 元
            </div>
            <label class="col-sm-2 text-sm-right col-form-label">在线支付</label>
            <div class="col-sm-3 col-form-label">
                <span class="text-red" th:text="${order.cashAmount / 100}"></span> 元
            </div>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">充值账户扣除</label>
            <div class="col-sm-3 col-form-label">
                <span class="text-red" th:text="${order.vmAmount / 100}"></span> 元
            </div>
            <label class="col-sm-2 text-sm-right col-form-label">返现账户扣除</label>
            <div class="col-sm-3 col-form-label">
                <span class="text-red" th:text="${order.backAmount / 100}"></span> 元
            </div>
        </div>

        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">订单状态</label>
            <span class="col-sm-3 col-form-label" th:text="${@dict.getLabel('qdx_order_state', order.status)}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">订单备注</label>
            <span class="col-sm-3 col-form-label" th:text="${order.description == null?'-':order.description}"></span>
        </div>
        <div class="form-group row">
            <label class="col-sm-2 text-sm-right col-form-label">支付时间</label>
            <span class="col-sm-3 col-form-label" th:text="${order.payTime}"></span>
            <label class="col-sm-2 text-sm-right col-form-label">下单时间</label>
            <span class="col-sm-3 col-form-label" th:text="${order.createTime}"></span>

        </div>
        <h4 class="form-header h4 pt-2 pb-2">商品信息</h4>
        <table class="table table-striped">
            <thead>
            <tr>
                <th style="width: 60px">id</th>
                <th>标题</th>
                <th style="width: 80px">类型</th>
                <th style="width: 80px">原价</th>
                <th style="width: 80px">销售价</th>
                <th style="width: 150px">过期时间</th>
                <th>描述</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="detail : ${orderDetails}">
                <td th:text="${detail.id}"></td>
                <td th:text="${detail.courseName}"></td>
                <td>
                    <span class="badge bg-blue" th:if="${detail.orderType=='COURSE'}">课程</span>
                    <span class="badge bg-green" th:if="${detail.orderType=='MEMBER'}">会员</span>
                    <span class="badge bg-danger" th:if="${detail.orderType=='ACCOUNT'}">充值</span>
                </td>
                <td><s><span class="text-red" th:text="${detail.sourcePrice/100.0}">0</span></s></td>
                <td><span class="text-red" th:text="${detail.price/100.0}">0</span></td>
                <td th:text="${detail.authDate}"></td>
                <td th:text="${detail.description}"></td>
            </tr>
            </tbody>
        </table>
        <h4 class="form-header h4 pt-2 pb-2" th:if="${order.orderType == 'COURSE' && order.status == 'SUCCESS'}">分成信息</h4>
        <table class="table table-striped" th:if="${order.orderType == 'COURSE' && order.status == 'SUCCESS'}">
            <thead>
            <tr>
                <th style="width: 60px">id</th>
                <th>账户名称</th>
                <th  style="width: 120px">类型</th>
                <th style="width: 120px">分配比例</th>
                <th style="width: 120px">分配金额</th>
                <th>备注</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="detail : ${orderAllotDetails}">
                <td th:text="${detail.id}"></td>
                <td th:text="${detail.accountName}+' (id='+${detail.accountId}+')'"></td>
                <td>
                    <span class="badge bg-blue" th:if="${detail.accountType==0}">用户</span>
                    <span class="badge bg-green" th:if="${detail.accountType==1}">机构</span>
                </td>
                <td><span class="text-red" th:text="${detail.allotRate}+' %'">0</span></td>
                <td><span class="text-red" th:text="${detail.allotAmount/100.0}">0</span></td>
                <td th:text="${detail.remark}"></td>
            </tr>
            </tbody>
        </table>
    </form>
</div>
<th:block th:insert="~{include :: footer}" />
</body>
</html>